package com.ljx.qqpro.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljx.qqpro.common.utils.PageUtil;
import com.ljx.qqpro.common.utils.Query;

import com.ljx.qqpro.dao.ContactsGroupDao;
import com.ljx.qqpro.entity.ContactsGroupEntity;
import com.ljx.qqpro.service.ContactsGroupService;


@Service("contactsGroupService")
public class ContactsGroupServiceImpl extends ServiceImpl<ContactsGroupDao, ContactsGroupEntity> implements ContactsGroupService {

    @Override
    public PageUtil queryPage(Map<String, Object> params) {
        IPage<ContactsGroupEntity> page = this.page(
                new Query<ContactsGroupEntity>().getPage(params),
                new QueryWrapper<ContactsGroupEntity>()
        );

        return new PageUtil(page);
    }

    @Override
    public List<ContactsGroupEntity> getUserContactsGroup(Long userId) {

        return this.baseMapper.selectList(new QueryWrapper<ContactsGroupEntity>().eq("status", 1).eq("creater_id", userId));
    }
}